package com.example.quce.controller;

import com.example.quce.common.R;
import com.example.quce.entity.Person;
import com.example.quce.mapper.PersonMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/person")
@RequiredArgsConstructor
public class PersonController {
    @Autowired
    PersonMapper personMapper;

    @GetMapping("/selectAllPerson")
    public R selectAllPerson() {
        // 读取person表中所有数据
        List<Person> personList=this.personMapper.selectAllPerson();
        // 把从数据库中读取的结果传回前端
        return R.ok(personList);
    }

}
